package com.hc.controller;

import com.hc.entity.DigitalSignature;
import com.hc.service.QcDigitalSignatureService;

import com.hc.util.SnowflakeUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.Date;
import java.util.UUID;

/**
 * @author 王小珂
 * @ClassName QcDigitalSignatureController
 * @Description
 * @date 2019/12/6/006
 */
@RestController
@RequestMapping("/signature")
@Api( tags= "电子签名")
public class QcDigitalSignatureController {

    @Autowired
    QcDigitalSignatureService signatureService;


    @PostMapping("")
    @ApiOperation("新增签名")
    public DigitalSignature saveDigitalSignature(@RequestBody DigitalSignature signature) {
        String signatureId = SnowflakeUtils.getUniqueId();
        signature.setSignatureId(signatureId);
        signature.setSignatureTime(new Date());
        signature.setIsSignature("1");
        signatureService.saveDigitalSignature(signature);
       return signatureService.insertSignature(signature);
    }
}
